import request from '@/utils/request'
import querystring from 'querystring'

/**
 * 报价单详情
 * @param {*} id 
 */
export function getQuoteDetail(id) {
  return request.get('/quote/detail/' + id)
}

export function getQuoteById(id) {
  return request.get('/quote/findById/' + id)
}

export function addQuote(param) {
  return request.post('/quote/save', param)
}

export function editQuote(param) {
  return request.put('/quote/save', param)
}

export function deleteQuote(id) {
  return request.delete('/quote/del/' + id)
}

export function quoteList(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/quote/page', data)
}
/**
 * 报价单项目分页
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function quoteProjectPage(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/quote/projectPage', data)
}
/**
 * 报价单精品分页查询
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function quoteJpPage(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/quote/jpPage', data)
}

/**
 * 配件分页查询
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function quotePartsPage(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/quote/partsPage', data)
}

//生成工单编号
export function quoteGetWorkOrderCode() {
  return request.get(`/quote/getWorkOrderCode`)
}
